<?php
defined('SYSPATH') OR die('No direct access allowed.');
/**
 * content.php
 * @author ranuandra
 *
 * 25 Jun 2012 09:29:38
 *
 * 
 */

class Model_Content extends ORM
{
	protected $_belongs_to = array(
						'user' 		=> array('model'  	=>  'user'),
						'category'	=> array('model'	=> 'category')
	);
	
	private $_field = array('title', 'deskripsi', 'category_id', 'flag_published');
	private $_form = array('title' => '', 'deskripsi' => '', 'flag_published'=>'', 'category_id' => '');
	
	public $rules = array(
					'title' => array(
									array('min_length', array(':value', 0)),
								),
					'deskripsi' => array(
									array('min_length', array(':value', 0)),
								),
					'category_id' => array(
									array('min_length', array(':value', 0)),
								),
					'flag_published' => array(
									array('min_length', array(':value', 0)),
								),

	);
	
	public function getField()
	{
		return $this->_field;
	}
	
	public function getForm()
	{
		return $this->_form;
		
	}
	
	public function create_data($values)
	{
	    return $this->values($values, $this->_field)->create();
	}
}